package com.example.demo.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import com.example.demo.dto.SearchInfo;
import com.example.demo.entity.Nurse;



@Repository()
public interface Nurse_Mapper extends BaseMapper<Nurse>{
	
	@Select("select nurse.*,department.name department_name "
			+ " from nurse inner join department on nurse.department_id=department.id ${where} ${limitstr}")
	public List<Nurse> select(SearchInfo info);
	@Select("select count(1) from nurse inner join department on nurse.department_id=department.id   ${where} ")
	public long selectCount(SearchInfo info);
	
	@Insert("insert into nurse (name,pass,department_id) values(#{name},#{pass},#{department_id})")
	public void insert (Nurse u);
	
	@Update("update nurse set name=#{name},department_id=#{department_id} where id=#{id}")
	public void update (Nurse u);
	
	
	@Select("delete from nurse where id=#{id}")
	public void delete(int id);
	
	@Select("select * from nurse where id=#{id} ")
	public Nurse selectById(int id);
	
	@Select("select * from nurse where name=#{name} ")
	public Nurse login(Nurse u);
	
}
